<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 定时器
    window.setInterval(function () {
      console.log("xuexi");
    },10000) ;
    // 每1s输出一个值，并且重复
    var i =0;
    var set = window.setInterval(function (){
      i++;
      console.log(i);
    }, 100);
    // 清楚定时器
    clearInterval(set)
    // 如果i》10 停止输出
    var j = 0
    var  set1 = window.setInterval(function () {
      console.log(j++);
      if (j > 10) {
        clearInterval(set1)
      }
    },1000)
  </script>
</body>
</html>